package com.formatos;

import java.io.File;
import java.io.IOException;

import javax.servlet.http.HttpServletResponse;

import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRExporter;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.export.JRXmlExporter;
import net.sf.jasperreports.engine.export.JRXmlExporterParameter;

public class XMLReport implements Formato{

	public File escribirReporte(JasperPrint jasperPrint, HttpServletResponse response) throws JRException, IOException {
		response.setContentType("text/xml");
		JRExporter jRExporter = new JRXmlExporter();
		jRExporter.setParameter(JRXmlExporterParameter.JASPER_PRINT, jasperPrint);
//		OutputStream output = response.getOutputStream();
//		jRExporter.setParameter(JRXmlExporterParameter.OUTPUT_STREAM, out);
//		jRExporter.exportReport();
//		output.close();
		return Util.export(jRExporter, "xml");
	}
	
	public Object clone() throws CloneNotSupportedException {
		return new XMLReport();
	}

}
